package com.shiguiwu.springmybatis.spring.aop.principle;


/**
 * @description: 提现服务
 * @author: stone
 * @date: Created by 2021/5/20 19:18
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.spring.aop.principle
 */
public class FunsService {

    private double balance = 1000;

    public double recharge(String username, double price) {
        System.out.println(String.format("%s充值了%s", username, price));
        balance += price;
        return balance;
    }

    public double cashOut(String username, double price) {
        if (balance < price) {
            throw new RuntimeException("余额不足，不能提现");

        }
        System.out.println(String.format("%s提现了%s", username, price));

        balance -= price;
        return balance;
    }

    double getBalance(String username) {
        return this.balance;
    }


}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//



